package com.itheima.reggie.common;

/**
 * @author Lff
 * @date 2022/2/25
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 获取id
     * @return
     */
    public static Long getId() {
        return threadLocal.get();
    }

    /**
     * 设置id
     * @param id
     */
    public static void setId(Long id) {
        threadLocal.set(id);
    }

    /**
     * 清理id
     */
    public static void removeId(){
        threadLocal.remove();
    }
}
